package d01_internalClass;

public class Test05 {
    public static void main(String[] args) {
        //匿名内部类的使用场景
        Swimming s=new Swimming() {
            @Override
            public void swin() {
                System.out.println("学生有的则快~~~");
            }
        };
        go(s);
        Swimming t=new Swimming() {
            @Override
            public void swin() {
                System.out.println("老师有的贼溜~~~~");
            }
        };
        go(t);
        go(new Swimming() {
            @Override
            public void swin() {
                System.out.println("🐱不会游泳");
            }
        });
        go(new Swimming() {
            @Override
            public void swin() {
                System.out.println("我也不会游泳");
            }
        });

    }
    public static void go(Swimming s){
        System.out.println("开始。。。");
        s.swin();
        System.out.println("结束。。。");
    }
}

interface Swimming{
    void swin();
}
